﻿using System;
namespace Producers.Liiklusregister.Xtee.Riik.Ee.Producer.Liiklusregister {
    
    
    [global::Xtee.Core.Attributes.XmlTypeAttribute(Name="soidukiandmed2isik_tulem", Namespace="http://producers.liiklusregister.xtee.riik.ee/producer/liiklusregister", Target=typeof(Soidukiandmed2isikTulem))]
    public class Soidukiandmed2isikTulemSerializer : global::Xtee.Core.Types.AbstractXteeSerializable {
        
        protected ISoidukiandmed2isikTulem clazz;
        
        public Soidukiandmed2isikTulemSerializer(ISoidukiandmed2isikTulem clazz) {
            this.clazz = clazz;
        }
        
        public override void WriteXml(global::Xtee.Core.IXteeXmlWriter Writer) {
            base.WriteXml(Writer);
            Writer.WriteStartElement("ikrkkood");
            if (clazz.Ikrkkood!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Ikrkkood))).ToString());
            }
            else {
                Writer.WriteAttributeString("xsi", "nil", null, "1");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("nimi");
            if (clazz.Nimi!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Nimi))).ToString());
            }
            else {
                Writer.WriteAttributeString("xsi", "nil", null, "1");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("eesnimi");
            if (clazz.Eesnimi!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Eesnimi))).ToString());
            }
            else {
                Writer.WriteAttributeString("xsi", "nil", null, "1");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("aadress");
            if (clazz.Aadress!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Aadress))).ToString());
            }
            else {
                Writer.WriteAttributeString("xsi", "nil", null, "1");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("indeks");
            if (clazz.Indeks!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "decimal");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdDecimal(((decimal)(clazz.Indeks))).ToString());
            }
            else {
                Writer.WriteAttributeString("xsi", "nil", null, "1");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("asuk_akood");
            if (clazz.AsukAkood!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.AsukAkood))).ToString());
            }
            else {
                Writer.WriteAttributeString("xsi", "nil", null, "1");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("tyyp");
            if (clazz.Tyyp!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Tyyp))).ToString());
            }
            else {
                Writer.WriteAttributeString("xsi", "nil", null, "1");
            }
            Writer.WriteEndElement();
        }
        
        public override void ReadXml(global::Xtee.Core.IXteeXmlReader Reader) {
            base.ReadXml(Reader);
        START:
            if ((Reader.LocalName == "ikrkkood")) {
                goto ikrkkood;
            }
            else {
                if ((Reader.LocalName == "nimi")) {
                    goto nimi;
                }
                else {
                    if ((Reader.LocalName == "eesnimi")) {
                        goto eesnimi;
                    }
                    else {
                        if ((Reader.LocalName == "aadress")) {
                            goto aadress;
                        }
                        else {
                            if ((Reader.LocalName == "indeks")) {
                                goto indeks;
                            }
                            else {
                                if ((Reader.LocalName == "asuk_akood")) {
                                    goto asuk_akood;
                                }
                                else {
                                    if ((Reader.LocalName == "tyyp")) {
                                        goto tyyp;
                                    }
                                    else {
                                        return;
                                    }
                                }
                            }
                        }
                    }
                }
            }
        ikrkkood:
            if ((Reader.IsElementNil() == false)) {
                clazz.Ikrkkood = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("ikrkkood")).Value;
            }
            else {
                Reader.Skip();
            }
            goto START;
        nimi:
            if ((Reader.IsElementNil() == false)) {
                clazz.Nimi = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("nimi")).Value;
            }
            else {
                Reader.Skip();
            }
            goto START;
        eesnimi:
            if ((Reader.IsElementNil() == false)) {
                clazz.Eesnimi = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("eesnimi")).Value;
            }
            else {
                Reader.Skip();
            }
            goto START;
        aadress:
            if ((Reader.IsElementNil() == false)) {
                clazz.Aadress = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("aadress")).Value;
            }
            else {
                Reader.Skip();
            }
            goto START;
        indeks:
            if ((Reader.IsElementNil() == false)) {
                clazz.Indeks = new global::Xtee.Core.Schema.XsdDecimal(Reader.ReadElementString("indeks")).Value;
            }
            else {
                Reader.Skip();
            }
            goto START;
        asuk_akood:
            if ((Reader.IsElementNil() == false)) {
                clazz.AsukAkood = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("asuk_akood")).Value;
            }
            else {
                Reader.Skip();
            }
            goto START;
        tyyp:
            if ((Reader.IsElementNil() == false)) {
                clazz.Tyyp = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("tyyp")).Value;
            }
            else {
                Reader.Skip();
            }
            goto START;
        }
    }
}
